import { getRequest } from "@/api/api"
import { postRequest } from "@/api/api"
import { v4 as uuidv4 } from "uuid";
export const UserService = {
    async getUsers(loginUUID, token) {
        let data = { uuid: loginUUID, token: token };
        return postRequest("users", data);
    },
    async getRecords(uuid) {
        let data = { uuid: uuid };
        return postRequest("query", data);
    },
    async addRecord(data, loginUUID, token) {
        data.id = uuidv4();
        data.loginUUID = loginUUID;
        data.token = token;
        return postRequest("add", data);
    },
    async updateRecord(data, loginUUID, token) {
        data.loginUUID = loginUUID;
        data.token = token;
        return postRequest("edit", data);
    },
    async addUser(data, loginUUID, token) {
        data.uuid = uuidv4();
        data.permission = 0;
        data.loginUUID = loginUUID;
        data.token = token;
        return postRequest("addUser", data);
    },

    async loginUser(data) {
        return postRequest("login", data);
    }
}